package cn.minimelon.bittermelon.utils;

import org.noear.snack.ONode;

import java.util.ArrayList;
import java.util.List;

public class JSONUtils {

    public static String toJSONString(Object obj) {
        return ONode.serialize(obj);
    }

    public static <T> T parseObject(String json, Class<T> clz) {
        return ONode.deserialize(json, clz);
    }

    public static <T> List<T> parseArray(String jsonArray, ArrayList<T> emptyArray) {
        return ONode.deserialize(jsonArray, emptyArray.getClass());
    }
}
